package com.google.code.puertorico.actors

import com.google.code.puertorico._
import scala.actors.Actor

object BuilderActor extends Actor {
  def act() {
    loop {
      react {
        case ActionSequence(state, actions) => {
          val player = state.activePlayer;
          for (building <- state.availableBuildings) {
            if (building.cost <= player.resources.gold) {

              // TODO:Can haz building?


              var newState = state.buyBuilding(building);

              // TODO NextPlayerActor ! (newState)

            }
          }
        }
      }
    }
  }
}
